#ifndef __DEF_MYAPP_H__
#define __DEF_MYAPP_H__

//#include <wx/wx.h>
#include <wx/fileconf.h>
#include <wx/stdpaths.h>
#include <wx/imaglist.h>
#include <wx/wxsqlite3.h>
#include "dbkakeibo.h"
#include "mypath.h"

class wxCmdLineParser;

class MyApp: public wxApp
{
public:
	MyApp();
    virtual bool OnInit();
	virtual int OnExit();
	
	wxSQLite3Database &SQLDB(void);
	DB_kakeibo AppDB;
	wxImageList *icoList;
	wxImageList *icoDList;
	wxImageList *sysicoList;
	const wxString &GetFilePath(void);
	void SetFilePath(wxString name);
	const wxString &GetTempFilePath(void);
	void SetTempFilePath(wxString name);
	bool IsNewFile(void);
	void SetNewFlag(bool flg);
	bool IsChanged(void);
	void SetChangeFlag(bool flg);
	void LoadIni(const wxString &path);
	void SaveIni(void);
	void LoadIconImage(const wxString &path, wxImageList *list, int ws, int hs);

	//void WriteLog(const wxString &mes) { wxLogMessage(mes.c_str()); }
	//void WriteLog(const wxChar *mes) { wxLogMessage(mes); }
	void WriteLog(const wxString &mes)
	{
		logqueue.Add(StrF(_T("%s: %s"),wxDateTime::Now().Format(_T("%Y/%m/%d %H:%M:%S")).c_str(),mes.c_str()));
	}
	wxArrayString &GetLogQueue(void) { return logqueue; }
	void ClearLog(void) { logqueue.Clear(); }

	wxString GetPathElement(size_t num);
	MyPath &GetStdPath(void) { return stpath; }

protected:
	wxLocale locale;
	wxSQLite3Database dbkakeibo;
	wxString DBFilePath;		//real kakeibo file path
	wxString tempDBFilePath;	//temporary kakeibo file path (for internal)
	bool isnew;
	bool ischanged;
	wxFileConfig *config;
	wxString inipath;
	MyPath stpath;
	//DB_kakeibo mainDB;
	wxArrayString pathstr;
	wxArrayString logqueue;
};


#endif